# $Id$
# Maintainer: Maxime Gauduin <alucryd@archlinux.org>
# Contributor: Ner0 <darkelfdarkelf666@yahoo.co.uk>

pkgname=scratch-text-editor
pkgver=2.4.1
pkgrel=2
pkgdesc='The Pantheon Text Editor'
arch=('loong64' 'x86_64')
url='https://launchpad.net/scratch'
license=('GPL3')
depends=('desktop-file-utils' 'glib2' 'glibc' 'gtk3' 'gtksourceview3' 'libgee'
         'libpeas' 'pango' 'zeitgeist'
         'libgranite.so')
makedepends=('cmake' 'gobject-introspection' 'gtkspell3' 'intltool' 'libsoup'
             'vala' 'vte3' 'webkit2gtk')
optdepends=('gtkspell3: Spell Check plugin'
            'libsoup: Pastebin plugin'
            'vala: Outline plugin'
            'vte3: Terminal plugin'
            'webkit2gtk: Browser Preview plugin')
source=("https://launchpad.net/scratch/2.x/${pkgver}/+download/scratch-text-editor-${pkgver}.tar.xz"
        rewrite-gtk-dialog.patch
        disable-source-tree-plugin.patch
        disable-clipboard-plugin.patch)
sha256sums=('74076d3fefc79a8261cfbd4eacc4e614d0a35e44c9e4c1f32ed23e81da704836'
            '00864340f42ceb5eef7fe3bf024331f1b4d849d6f4ce8a0951929f249a81a9dc'
            '7120cb3fe139cfc7855c50bc3d34e56aa3a921983c347bd6c8a8627340949010'
            'f80ad2c84731ab85d40e49ebd0c6749855947b4a27876acb99643b2999d7cbe0')

prepare() {
  cd scratch-text-editor-${pkgver}

  if [[ -d build ]]; then
    rm -rf build
  fi
  mkdir build
  patch -Np1 -i ../rewrite-gtk-dialog.patch
  patch -Np1 -i ../disable-source-tree-plugin.patch
  patch -Np1 -i ../disable-clipboard-plugin.patch
}

build() {
  cd scratch-text-editor-${pkgver}/build

  cmake .. \
    -DCMAKE_BUILD_TYPE='Release' \
    -DCMAKE_INSTALL_PREFIX='/usr' \
    -DCMAKE_INSTALL_LIBDIR='/usr/lib' \
    -DGSETTINGS_COMPILE='FALSE'
  make
}

package() {
  cd scratch-text-editor-${pkgver}/build

  make DESTDIR="${pkgdir}" install
}

# vim: ts=2 sw=2 et:
